package easy;

/**
 * @author admin
 * 1512. 好数对的数目
 * 暴力解法非常简单，缺点是时间复杂度为O（n2）,但节省了空间
 */
public class LeeCode1512 {

    public int numIdenticalPairs(int[] nums) {

        int count = 0;
        for (int i = 0; i < nums.length; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                if (nums[i] == nums[j]){
                    count++;
                }
            }
        }
        return count;
    }

    public static void main(String[] args) {
        System.out.println(new LeeCode1512().numIdenticalPairs(new int[]{1, 1, 1, 1}));
    }
}
